import http from '@/utils/http'

export enum Api {
  list = '/sys/user/list',
  deleteUser = '/sys/user/delete',
  userInfo = '/sys/user/info',
  roleSelect = '/sys/role/select'
}

export function getList(params: any) {
  return http.get<any>(Api.list, {
    params: params
  })
}

export function deleteUser(ids: Array<number>) {
  return http.post(Api.deleteUser, ids)
}

export function userInfo(params: any) {
  return http.get<any>(Api.userInfo, {
    params: params
  })
}

export function roleSelect() {
  return http.get<any>(Api.roleSelect)
}

export function saveOrUpdate(data: any) {
  return http.post<any>(`/sys/user/${data.id ? 'update' : 'save'}`, data)
}
